/* -*- c++ -*- */
/*
 * Copyright 2018 Ahmet Inan, Ron Economos.
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

/*
 * DVB-T2 LDPC parity bit address tables
 *
 * Entries below copied from:
 * http://www.etsi.org/deliver/etsi_en/302700_302799/302755/01.04.01_60/en_302755v010401p.pdf
 *
 */

#ifndef DVB_T2_TABLES_HH
#define DVB_T2_TABLES_HH

struct DVB_T2_TABLE_A3 {
  static const int M = 360;
  static const int N = 64800;
  static const int K = 43200;
  static const int LINKS_MIN_CN = 9;
  static const int LINKS_MAX_CN = 10;
  static const int LINKS_TOTAL = 215999;
  static const int DEG_MAX = 13;
  static constexpr int DEG[] = {13, 3, 0};
  static constexpr int LEN[] = {12, 108, 0};
  static constexpr int POS[] = {
      317,   2255,  2324,  2723,  3538,  3576,  6194,  6700,  9101,  10057, 12739, 17407,
      21039, 1958,  2007,  3294,  4394,  12762, 14505, 14593, 14692, 16522, 17737, 19245,
      21272, 21379, 127,   860,   5001,  5633,  8644,  9282,  12690, 14644, 17553, 19511,
      19681, 20954, 21002, 2514,  2822,  5781,  6297,  8063,  9469,  9551,  11407, 11837,
      12985, 15710, 20236, 20393, 1565,  3106,  4659,  4926,  6495,  6872,  7343,  8720,
      15785, 16434, 16727, 19884, 21325, 706,   3220,  8568,  10896, 12486, 13663, 16398,
      16599, 19475, 19781, 20625, 20961, 21335, 4257,  10449, 12406, 14561, 16049, 16522,
      17214, 18029, 18033, 18802, 19062, 19526, 20748, 412,   433,   558,   2614,  2978,
      4157,  6584,  9320,  11683, 11819, 13024, 14486, 16860, 777,   5906,  7403,  8550,
      8717,  8770,  11436, 12846, 13629, 14755, 15688, 16392, 16419, 4093,  5045,  6037,
      7248,  8633,  9771,  10260, 10809, 11326, 12072, 17516, 19344, 19938, 2120,  2648,
      3155,  3852,  6888,  12258, 14821, 15359, 16378, 16437, 17791, 20614, 21025, 1085,
      2434,  5816,  7151,  8050,  9422,  10884, 12728, 15353, 17733, 18140, 18729, 20920,
      856,   1690,  12787, 6532,  7357,  9151,  4210,  16615, 18152, 11494, 14036, 17470,
      2474,  10291, 10323, 1778,  6973,  10739, 4347,  9570,  18748, 2189,  11942, 20666,
      3868,  7526,  17706, 8780,  14796, 18268, 160,   16232, 17399, 1285,  2003,  18922,
      4658,  17331, 20361, 2765,  4862,  5875,  4565,  5521,  8759,  3484,  7305,  15829,
      5024,  17730, 17879, 7031,  12346, 15024, 179,   6365,  11352, 2490,  3143,  5098,
      2643,  3101,  21259, 4315,  4724,  13130, 594,   17365, 18322, 5983,  8597,  9627,
      10837, 15102, 20876, 10448, 20418, 21478, 3848,  12029, 15228, 708,   5652,  13146,
      5998,  7534,  16117, 2098,  13201, 18317, 9186,  14548, 17776, 5246,  10398, 18597,
      3083,  4944,  21021, 13726, 18495, 19921, 6736,  10811, 17545, 10084, 12411, 14432,
      1064,  13555, 17033, 679,   9878,  13547, 3422,  9910,  20194, 3640,  3701,  10046,
      5862,  10134, 11498, 5923,  9580,  15060, 1073,  3012,  16427, 5527,  20113, 20883,
      7058,  12924, 15151, 9764,  12230, 17375, 772,   7711,  12723, 555,   13816, 15376,
      10574, 11268, 17932, 15442, 17266, 20482, 390,   3371,  8781,  10512, 12216, 17180,
      4309,  14068, 15783, 3971,  11673, 20009, 9259,  14270, 17199, 2947,  5852,  20101,
      3965,  9722,  15363, 1429,  5689,  16771, 6101,  6849,  12781, 3676,  9347,  18761,
      350,   11659, 18342, 5961,  14803, 16123, 2113,  9163,  13443, 2155,  9808,  12885,
      2861,  7988,  11031, 7309,  9220,  20745, 6834,  8742,  11977, 2133,  12908, 14704,
      10170, 13809, 18153, 13464, 14787, 14975, 799,   1107,  3789,  3571,  8176,  10165,
      5433,  13446, 15481, 3351,  6767,  12840, 8950,  8974,  11650, 1430,  4250,  21332,
      6283,  10628, 15050, 8632,  14404, 16916, 6509,  10702, 16278, 15900, 16395, 17995,
      8031,  18420, 19733, 3747,  4634,  17087, 4453,  6297,  16262, 2792,  3513,  17031,
      14846, 20893, 21563, 17220, 20436, 21337, 275,   4107,  10497, 3536,  7520,  10027,
      14089, 14943, 19455, 1965,  3931,  21104, 2439,  11565, 17932, 154,   15279, 21414,
      10017, 11269, 16546, 7169,  10161, 16928, 10284, 16791, 20655, 36,    3175,  8475,
      2605,  16269, 19290, 8947,  9178,  15420, 5687,  9156,  12408, 8096,  9738,  14711,
      4935,  8093,  19266, 2667,  10062, 15972, 6389,  11318, 14417, 8800,  18137, 18434,
      5824,  5927,  15314, 6056,  13168, 15179, 3284,  13138, 18919, 13115, 17259, 17332,
  };
};

struct DVB_T2_TABLE_B3 {
  static const int M = 360;
  static const int N = 16200;
  static const int K = 9720;
  static const int LINKS_MIN_CN = 8;
  static const int LINKS_MAX_CN = 9;
  static const int LINKS_TOTAL = 58319;
  static const int DEG_MAX = 12;
  static constexpr int DEG[] = {12, 3, 0};
  static constexpr int LEN[] = {5, 22, 0};
  static constexpr int POS[] = {
      71,   1478, 1901, 2240, 2649, 2725, 3592, 3708, 3965, 4080, 5733, 6198, 393,  1384,
      1435, 1878, 2773, 3182, 3586, 5465, 6091, 6110, 6114, 6327, 160,  1149, 1281, 1526,
      1566, 2129, 2929, 3095, 3223, 4250, 4276, 4612, 289,  1446, 1602, 2421, 3559, 3796,
      5590, 5750, 5763, 6168, 6271, 6340, 947,  1227, 2008, 2020, 2266, 3365, 3588, 3867,
      4172, 4250, 4865, 6290, 3324, 3704, 4447, 1206, 2565, 3089, 529,  4027, 5891, 141,
      1187, 3206, 1990, 2972, 5120, 752,  796,  5976, 1129, 2377, 4030, 6077, 6108, 6231,
      61,   1053, 1781, 2820, 4109, 5307, 2088, 5834, 5988, 3725, 3945, 4010, 1081, 2780,
      3389, 659,  2221, 4822, 3033, 6060, 6160, 756,  1489, 2350, 3350, 3624, 5470, 357,
      1825, 5242, 585,  3372, 6062, 561,  1417, 2348, 971,  3719, 5567, 1005, 1675, 2062,
  };
};

#endif
